import { action, observable, toJS } from 'mobx'

import {

    getAlreadyOrder,

    getAlreadyChart,

    getAverageTime,

    getAverageTimeChart,

    getAverageDay,

    getAverageDayChart,

    getResponseTime,

    getResponseTimeChart,

    getAlreadyList,

    getThatYearConsume,

    getEquipConsume,

    getState,

    getDownTime,

    getDownTimeC,

    getUnfinished,

    getLogWarning,

    getErrorTen,

    getGlazingTime,

    getPreProgress,

    getPreProgressList,

    getDailyError,

    getInterrupt,

    getMLCPressure,

    getWaterFlow,

    getTxDoseRate,

    getMVCTDoseRate,

    getTemperature,

    getFinalDose,

    getFinalDoseTwo,

    getTxGunI,

    getMVCTGunI,

    getTxPAC,

    getMVCTPAC,

    getTxInjI,

    getMVCTInjI,

    getTxAFC,

    getMVCTAFC,
    getNewLog,

} from '../apis/First/LeftOneMid/api'



import {

    getOpenWo,

    getNotOpenWo,

    getNotOpenWoChart,

    getHotOrder,

    getPrepareOrder,

    getEmergencyr,
    getLogistics,
    getFlyLine,
} from '../apis/First/leftTwo/api'

import { getAllMac, getNortheastArea, getWaringLight, getWaringLightLOG } from '../apis/First/Map/api'

import {

    getSlideTitle,

    getPredictWaring,

    getError,

    getBeforeAge,

    getBeforeAgeChart,

    getLightHour,

    getPatientTX,

    getPatientMVCT,

    getMacLogo,

    getMacInfo,
    getExceptionInterrupt,
    getEquipmentLoad,
    getTop10

} from '../apis/First/RightOneTopOne/api'

import {

    IEmergencyrType,

    IHotOrderType,

    IPrepareType,

    INorthEastType,

    IWaringType,

    IPredictType,

    IErrorType,

    IBeforeAge,

    IOrderListType,

    IEquipType,

    IStateType,

    IDownTimeType,

    IFinishType,

    ILogType,

    IDeviceType, IErrorTenType,
    logError,
    logTop10,
    handleObj

} from '../type/firstType'





class FirstStore {



    @observable

    public weather: any = null



    @observable public isUpDate: boolean = false



    @observable

    public name: string = ''



    @observable

    public arr: string[] = []



    @observable

    public dataPre: string[] = []



    // SMX

    @observable

    public redArr: any[] = []

    @observable

    public yellowArr: any[] = []



    // LOG

    @observable

    public redArrLog: any[] = []

    @observable

    public yellowArrLog: any[] = []



    @observable

    public macNumArr: any[] = []// 存储散点图对应的设备号

    @observable

    public macNumArrLog: any[] = []// 存储散点图对应的设备号



    @observable

    public lightAll: {

        Latitude: string

        Longitude: string

        MachineId: string

        warning: string

    }[] = []// 地图的预警灯ALL



    @observable

    public numAll: any[] = []



    @observable public year: any = null

    @observable public month: any = null

    @observable public day: any = null

    @observable public hour: any = null

    @observable public week: any = null



    @observable public yearM: any = null

    @observable public monthM: any = null

    @observable public dayM: any = null

    @observable public hourM: any = null

    @observable public weekM: any = null



    // 设备号

    @observable

    public SerialLotNumber: any = 110553

    //public SerialLotNumber: any = null



    // 地址

    @observable

    public location: string



    @observable

    public openWo: Array<{ info: string }> = []// openwo数量



    @observable

    public noOpenWo: {

        IsSystemdown: number,// 宕机数

        technician: number,// 总工单数

        workNum: number,// 开着的工单数

        todayNum: number// 仅一天工单数

    }// 未完成打开的wo数量



    @observable

    public hotOrderList: IHotOrderType[] = []// 热门工单列表



    @observable

    public prepareList: IPrepareType[] = []// 待批准备件列表



    @observable

    public emergencyrList: IEmergencyrType[] = []// 紧急备件订单信息列表



    @observable

    public flyLine: any[] = []// 飞线图



    @observable

    public flyLineOne: any[] = []// 飞线图图表数据



    @observable

    public slideTitle: string = ''// 右屏滑动的标题



    @observable

    public northEastArea: INorthEastType// 东北区客户服务区域

    @observable

    public northArea: INorthEastType// 北区客户服务区域

    @observable

    public eastArea: INorthEastType// 东区客户服务区域

    @observable

    public southArea: INorthEastType// 南区客户服务区域

    @observable

    public westArea: INorthEastType// 西区客户服务区域





    @observable

    public countOrderCM: number// 已完成的工单数量

    @observable

    public countOrderPM: number// 已完成的工单数量

    @observable

    public countOrderCV: number// 已完成的工单数量

    @observable

    public countOrderII: number// 已完成的工单数量

    @observable

    public countOrderCS: number// 已完成的工单数量

    @observable

    public orderData: number[] = []// 已完成的工单数量图表（Y）

    @observable

    public orderDataX: string[] = []// 已完成的工单数量图表（X）

    @observable

    public orderList: IOrderListType[] = []// 已完成的工单数量列表



    @observable

    public countOrderFiveX: string[] = []// 已完成的工单数量(5图表)



    @observable

    public countOrderFiveAllY: any// 已完成的工单数量(5图表)

    @observable

    public countOrderFiveCMY: number[] = []// 已完成的工单数量(5图表)

    @observable

    public countOrderFivePMY: number[] = []// 已完成的工单数量(5图表)

    @observable

    public countOrderFiveCVY: number[] = []// 已完成的工单数量(5图表)

    @observable

    public countOrderFiveIIY: number[] = []// 已完成的工单数量(5图表)

    @observable

    public countOrderFiveCSY: number[] = []// 已完成的工单数量(5图表)



    @observable

    public countAverage: number// 平均响应时长

    @observable

    public averageDataY: number[] = []// 平均响应时长图表（Y）

    @observable

    public averageDataX: string[] = []// 平均响应时长图表（X）



    @observable

    public averageDay: number// 平均维修天数

    @observable

    public averageDayY: number[] = []// 平均维修天数图表（Y）

    @observable

    public averageDayX: string[] = []// 平均维修天数图表（X）



    @observable

    public responseTime: number// 紧急备件响应时间 critical
    @observable
    public identify: boolean // 控制显示隐藏

    @observable
    public newResAverage: number// 紧急备件响应时间平均值 critical
    @observable
    public newTimeAverage: number// 现场响应时间平均值 critical
    @observable

    public responseTimeU: number// 紧急备件响应时间 urgent

    @observable

    public responseTimeFY: number[] = []// 紧急备件响应时间图表（Y）critical

    @observable

    public responseTimeX: string[] = []// 紧急备件响应时间图表（X）critical

    @observable

    public responseTimeUFY: number[] = []// 紧急备件响应时间图表（Y）urgent

    @observable

    public responseTimeUX: string[] = []// 紧急备件响应时间图表（X）urgent



    @observable

    public noOpenWoY: number[] = []// 未完成openWoY

    @observable

    public noOpenWoX: string[] = []// 未完成openWoX

    // 获取日志Top10
    @observable

    public top10Data: logTop10[] = []// 未完成openWoX

    // 预测警报前十名
    @observable
    public logTop: logError[] = []

    @observable

    public predictWarning: IPredictType[] = []



    @observable

    public waringLight: {

        data_red: IWaringType[],

        data_yellow: IWaringType[]

    } // 地图的预警灯



    @observable

    public waringLightLog: {

        Latitude: string

        Longitude: string

        MachineId: string

        warning: string

    }[] = []// 地图的预警灯LOG



    // 获取错误率前十名

    @observable

    public error: IErrorType[] = []



    // 获取上次输入日志年龄

    @observable

    public beforeAge: IBeforeAge

    // 获取上次输入日志年龄图表X

    @observable

    public beforeChartX: string[] = []

    // 获取上次输入日志年龄图表Y

    @observable

    public beforeChartY: number[] = []

    // 获取异常中断
    @observable

    public ExceptionX: string[] = []
    @observable
    public ExceptionY: number[] = []

    //  获取设备负荷
    @observable

    public EquipmentX: string[] = []
    @observable
    public EquipmentY: number[] = []


    // 获取PatientTXX

    @observable

    public patientTXX: string[] = []

    // 获取PatientTXY

    @observable

    public patientTXY: number[] = []



    // 获取PatientMTXX

    @observable

    public patientMTXX: string[] = []

    // 获取PatientMTXX

    @observable

    public patientMTXY: number[] = []

    // 获取PatientMTXX

    @observable

    public patientMVCTX: string[] = []

    // 获取PatientMTXX

    @observable

    public patientMVCTY: number[] = []



    // 当年备件消耗情况

    @observable

    public equipConsume: IEquipType[] = []



    // 当年工时消耗情况X

    @observable

    public dayConsumeX: string[] = []

    // 当年工时消耗情况Y

    @observable

    public dayConsumeY: number[] = []



    // 工程师状态

    @observable

    public engineerStatus: IStateType[] = []



    // 停机时间

    @observable

    public downTimeX: string[] = []

    // 停机时间

    @observable

    public downTimeYB: number[] = []

    // 停机时间

    @observable

    public downTimeYL: number[] = []



    // 获取停机时间摘要

    @observable

    public uptime_rate: number = 0



    // 获取未接工作单

    @observable

    public unFinished: IFinishType[] = []



    // 获取零件物流信息

    @observable

    public getPartsLogistics: null



    // 日志预测警报

    @observable

    public getLogInfo: ILogType[] = []



    // 发射剂量率

    @observable

    public sendInterruptY1: number[][] = []

    @observable

    public sendInterruptY2: number[][] = []

    @observable

    public sendInterruptY3: number[][] = []



    // mvct剂量率

    @observable

    public MVCTDoseRateY1: number[][] = []

    @observable

    public MVCTDoseRateY2: number[][] = []

    @observable

    public MVCTDoseRateY3: number[][] = []



    // 温度

    @observable

    public TemperatureY1: number[][] = []

    @observable

    public TemperatureY2: number[][] = []

    @observable

    public TemperatureY3: number[][] = []



    // 水流

    @observable

    public WaterFlowY1: number[][] = []

    @observable

    public WaterFlowY2: number[][] = []

    @observable

    public WaterFlowY3: number[][] = []

    @observable

    public WaterFlowY4: number[][] = []

    @observable

    public WaterFlowY5: number[][] = []



    // Jaw

    @observable

    public JawPotY1: number[][] = []

    @observable

    public JawPotY2: number[][] = []

    @observable

    public JawPotY3: number[][] = []



    // 每日错误率

    @observable

    public dailyError: number[][] = []



    // 维修进程

    @observable

    public processX: string[] = []

    @observable

    public processY1: number[] = []

    @observable

    public processY2: number[] = []



    // 上光

    @observable

    public beamHourX: string[] = []

    @observable

    public beamHourY1: number[] = []

    @observable

    public beamHourY2: number[] = []



    // 上光

    @observable

    public errorTen: IErrorTenType[] = []



    // 剂量一

    @observable

    public FinalDose1RateY1: number[][] = []

    @observable

    public FinalDose1RateY2: number[][] = []



    // 剂量二

    @observable

    public FinalDose2RateY1: number[][] = []

    @observable

    public FinalDose2RateY2: number[][] = []



    // Tx gun I

    @observable

    public TxGunIY1: number[][] = []

    @observable

    public TxGunIY2: number[][] = []

    @observable

    public TxGunIY3: number[][] = []



    // MVCT gun I

    @observable

    public MvctGunIY1: number[][] = []

    @observable

    public MvctGunIY2: number[][] = []

    @observable

    public MvctGunIY3: number[][] = []



    // TxPac

    @observable

    public TxPacY1: number[][] = []

    @observable

    public TxPacY2: number[][] = []

    @observable

    public TxPacY3: number[][] = []

    @observable

    public TxPacY4: number[][] = []

    @observable

    public TxPacY5: number[][] = []



    // MvctPac

    @observable

    public MvctPacY1: number[][] = []

    @observable

    public MvctPacY2: number[][] = []

    @observable

    public MvctPacY3: number[][] = []

    @observable

    public MvctPacY4: number[][] = []

    @observable

    public MvctPacY5: number[][] = []



    // Txinji

    @observable

    public TxInjIPacY1: number[][] = []

    @observable

    public TxInjIPacY2: number[][] = []

    @observable

    public TxInjIPacY3: number[][] = []

    @observable

    public TxInjIPacY4: number[][] = []

    @observable

    public TxInjIPacY5: number[][] = []



    // Mvctinji

    @observable

    public MvctInjIPacY1: number[][] = []

    @observable

    public MvctInjIPacY2: number[][] = []

    @observable

    public MvctInjIPacY3: number[][] = []

    @observable

    public MvctInjIPacY4: number[][] = []

    @observable

    public MvctInjIPacY5: number[][] = []



    // TX Afc

    @observable

    public TxAfcY1: number[][] = []

    @observable

    public TxAfcY2: number[][] = []

    @observable

    public TxAfcY3: number[][] = []



    // TX Afc

    @observable

    public MvctAfcY1: number[][] = []

    @observable

    public MvctAfcY2: number[][] = []

    @observable

    public MvctAfcY3: number[][] = []



    // 设备信息

    @observable

    public deviceInfo: IDeviceType



    // 发送中断

    @observable

    public interruptY1: number[] = []

    @observable

    public interruptY2: number[] = []

    @observable

    public interruptY3: number[] = []

    @observable

    public interruptY2All: number

    @observable

    public interruptY3All: number

    @observable

    public interruptY4All: number

    @observable

    public interruptY5All: number

    @observable

    public interruptX: string[] = []

    @observable

    public interruptY4: number[] = []

    @observable

    public interruptY5: number[] = []



    // 第一屏的第一部分的接口

    @action.bound

    public initFirst = () => {

        // // 获取五个工单的数量（CM,PM,CV,II,CP），五个工单图表

        this.handleGetAlready('Corrective Maintenance (CM)')

        this.handleGetAlready('Preventative Maintenance (PM)')

        this.handleGetAlready('Customer Visit')

        this.handleGetAlready('Install/Upgrade issues')

        this.handleGetAlready('Clinical/Physics support')

        this.handleGetAlreadyChartFive()

        this.handleAverageTime() // 现场响应时间

        this.handleAverageTimeChart()

        this.handleResponseTime('urgent')// 紧急备件响应时间 'urgent'

        this.handleResponseTimeChart('urgent')

        this.handleResponseTime('critical')// 紧急备件响应时间 'urgent'

        this.handleResponseTimeChart('critical')

        // // 中间部分

        this.getNortheastArea('APAC CAMT NorthEast') // 获取东北区客户服务区域

        this.getNortheastArea('APAC CAMT North')  // 北区

        this.getNortheastArea('APAC CAMT West') // 西区

        this.getNortheastArea('APAC CAMT East') // 东区

        this.getNortheastArea('APAC CAMT South') // 南区

        this.handleGetWaring() // 预警灯SMX

        this.handleGetWaringLOG()  // 预警灯LOG

        this.handleGetWaringAll() // 全部预警数据

        this.handleGetEmergencyr() // 飞线图

        // // 右边部分

        this.handleGetSlide() // 获取右侧滚屏标题

        this.handleBeforeAge() // 获取上次日志输入的年龄

        this.handleBeforeAgeChart() // 获取上次日志输入的年龄图表

        this.handleGetError() // 获取错误率前十名

        this.handlePatientTX()// 治疗分次统计

        this.handleEquipmentTX() // 设备负荷


        // this.handleLightHour() // 负荷率

    }

    // 第一屏的第二部分的接口

    @action.bound

    public initFirstSecond = () => {
        console.log(this.SerialLotNumber, '初始值被改变了？')

        // 左一
        this.handleGetLogistics(); // 备件物流信息
        this.handleGetHotOrder() // 热门工单列表

        this.getNotOpenWo() // 获取未完成打开的Wo信息

        this.getNotOpenWoChart() // 获取未完成打开的Wo信息图表

        // // 备件物流状态，和第一部分公用数据

        // // 中间地图数据不用刷新

        // // 右一

        // // 获取右侧滚屏标题,和第一屏的公用数据

        this.handleGetPredictWaring() // 获取预测警报前十名
        this.handleExceptionTX() // 异常中断统计
        this.getTop10Data(); // 获取错误日志Top10
        // TODO 异常中断统计和报错率统计未对数据

    }

    // 第二屏的第一部分接口
    @observable

    public timer: any
    @action.bound

    public initSecond = () => {
        // 

        // 获取五个工单的数量（CM,PM,CV,II,CP），五个工单图表

        this.handleGetAlready('Corrective Maintenance (CM)')

        this.handleGetAlready('Preventative Maintenance (PM)')

        this.handleGetAlready('Customer Visit')

        this.handleGetAlready('Install/Upgrade issues')

        this.handleGetAlready('Clinical/Physics support')

        //this.handleLogo() // 获取location字段

        // // 中间部分

        this.handleGetLogo()  // 获取设备图标

        this.handleInterrupt() // 发送中断



        this.handleGetAlreadyChartFive()

        this.handleGetEquipConsume() // 当年备件消耗情况

        // // TODO 数据未对

        this.handleGetConsume() // 当年工时消耗情况

        this.handleMVCTDoseRate('TX') // 获取四周的数据

        this.handleMVCTDoseRate('MVCT') // 获取四周的数据/MVCT_Dose_Rate

        this.handleTemperature() // 获取四周的数据/Temperature
        this.handleWaterFlow() // 获取水流
        this.timer = window.setTimeout(() => {
            console.log('定时器呢')
            this.anthoerData()
        }, 10000)
    }
    // 设置定时器

    // 隐藏的10个散点图数据
    @action.bound

    public anthoerData = () => {
        this.handleMLCPressure() // 获取MLC气压
        this.handleFinalDose()  // 获取四周的数据/最终剂量一率


        this.handleTxGunI() // 获取四周的数据/TX_Gun_I

        this.handleMVCTGunI() // 获取四周的数据/MVCT_Gun_I

        this.handleTxPAC() // 获取四周的数据/Tx_PAC

        this.handleMVCTPAC() // 获取四周的数据/MVCT_PAC

        this.handleTxInjI() // 获取四周的数据/Tx_Inj_I

        this.handleMVCTInjI() // 获取四周的数据/MVCT_Inj_I

        this.handleTxAFC() // 获取四周的数据/Tx_AFC

        this.handleMVCTAFC()  // 获取四周的数据/MVCT_AFC
    }
    // 第二屏的第二部分接口

    @action.bound

    public initSecondS = () => {

        // 头部和第一部分相同组件
        this.handleGetLogisticsNew(); // 备件物流信息
        this.handleGetDownTimeC() // 获取停机时间摘要

        this.handleGetDownTime() // 获取停机时间

        this.handleGetUnfinished() // 获取未结工作单

        this.handlePreProgress() // 获取预防性维修进度

        // // 物流信息和第一部分公用

        // // 中间部分公用组件

        // // 右一

        // // 获取设备图标，和第一部分公用

        this.handleGetLog() // 获取日志预测警报

        this.handleDailyError() // 获取每日错误率

        this.handleGetErrorTen() // 获取错误率前十名

    }

    @action.bound

    public initialize = async () => {

        // 获取四周的数据

        //this.handleMVCTDoseRate('TX')

        // 获取四周的数据/MVCT_Dose_Rate

        //this.handleMVCTDoseRate('MVCT')

        // // 获取最近两小时内新的openWo信息

        // this.handleOpenWo()



        // // 获取去热门工单列表

        // this.handleGetHotOrder()



        // // 获取待批准备件列表

        // this.handleGetPrepareOrder()



        // // 获取紧急备件信息列表

        // this.handleGetEmergencyr()





        // // 获取错误率前十名

        // this.handleGetError()



        // // 获取上次日志输入的年龄

        // this.handleBeforeAge()

        // // 获取上次日志输入的年龄图表

        // this.handleBeforeAgeChart()



        // // 获取每小时光束

        // this.handleLightHour()



        // // 获取patient TX前五名

        this.handlePatientTX()

        // // 获取patient MVCT前五名

        // this.handlePatientMVCT()



        // // 获取当年工时消耗情况

        this.handleGetConsume()



        // // 获取当年备件消耗情况

        this.handleGetEquipConsume()



        // // 获取工程师状态表

        // this.handleGeState()



        // // 获取未结工作单

        // this.handleGetUnfinished()



        // // 获取错误率前十名

        // this.handleGetErrorTen()



        // // 获取上光时间

        // this.handleGlazingTime()



        // // 获取预防性维修进度

        // this.handlePreProgress()



        // // 发送中断

        // this.handleInterrupt()



        // // 获取MLC气压

        // this.handleMLCPressure()



        // // 获取水流

        // this.handleWaterFlow()





        // // 获取四周的数据/Temperature

        // this.handleTemperature()

        // // 获取四周的数据/最终剂量一率

        // this.handleFinalDose()

        // // 获取四周的数据/Final_Dose_2_Rate

        // // this.handleFinalDoseTwo()

        // // 获取四周的数据/TX_Gun_I

        // this.handleTxGunI()

        // // 获取四周的数据/MVCT_Gun_I

        // this.handleMVCTGunI()

        // // 获取四周的数据/Tx_PAC

        // this.handleTxPAC()

        // // 获取四周的数据/MVCT_PAC

        // this.handleMVCTPAC()

        // // 获取四周的数据/Tx_Inj_I

        // this.handleTxInjI()

        // // 获取四周的数据/MVCT_Inj_I

        // this.handleMVCTInjI()

        // // 获取四周的数据/Tx_AFC

        // this.handleTxAFC()

        // // 获取四周的数据/MVCT_AFC

        // this.handleMVCTAFC()



        // // 获取设备图标

        this.handleGetLogo()



        // this.handleLogo()



    }



    // 获取已完成的工单数量(CM,PM,CV,CS)

    @action.bound

    public handleGetAlready = async (type: string) => {

        try {

            const resp = (await getAlreadyOrder({

                PurposeofVisit: type,

                SerialLotNumber: this.SerialLotNumber ? this.SerialLotNumber : ''

            })).data

            switch (type) {

                case 'Corrective Maintenance (CM)':

                    this.countOrderCM = resp.data.count

                    break;

                case 'Preventative Maintenance (PM)':

                    this.countOrderPM = resp.data.count

                    break;

                case 'Customer Visit':

                    this.countOrderCV = resp.data.count

                    break;

                case 'Install/Upgrade issues':

                    this.countOrderII = resp.data.count

                    break;

                case 'Clinical/Physics support':

                    this.countOrderCS = resp.data.count

                    break;

            }

        } catch (e) {

            console.log(e)

        }

    }



    // 获取已完成的工单数量图表

    public handleGetAlreadyChart = async () => {

        try {

            let arr: number[] = []

            let arrX: string[] = []

            const resp = (await getAlreadyChart({})).data

            resp.data.slice(0, 12).forEach((item) => {

                arr.push(item.num)

                arrX.push(item.time)

            })

            this.orderData = arr

            this.orderDataX = arrX

        } catch (e) {

            console.log(e)

        }

    }



    // 获取已完成的工单数量图表(五个)

    public handleGetAlreadyChartFive = async () => {

        try {

            const resp = (await getAlreadyChart({

                PurposeofVisit: ['Corrective Maintenance (CM)', 'Preventative Maintenance (PM)',

                    'Customer Visit', 'Install/Upgrade issues', 'Clinical/Physics support'],

                SerialLotNumber: this.SerialLotNumber ? this.SerialLotNumber : ''

            })).data

            this.countOrderFiveAllY = resp.data

            let arr: string[] = []

            resp.data.x_list.forEach((item) => {

                arr.push(String((new Date(item * 1000).getMonth() + 1) + '月'))

            })

            this.countOrderFiveX = arr

            this.countOrderFiveCMY = resp.data.y_list['Corrective Maintenance (CM)']

            this.countOrderFivePMY = resp.data.y_list['Preventative Maintenance (PM)']

            this.countOrderFiveCVY = resp.data.y_list['Customer Visit']

            this.countOrderFiveIIY = resp.data.y_list['Install/Upgrade issues']

            this.countOrderFiveCSY = resp.data.y_list['Clinical/Physics support']

        } catch (e) {

            console.log(e)

        }

    }



    // 获取已完成的工单数量列表

    public handleGetAlreadyList = async () => {

        try {

            const resp = (await getAlreadyList({})).data

            this.orderList = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取平均响应时长

    public handleAverageTime = async () => {

        try {

            const resp = (await getAverageTime({})).data

            this.countAverage = resp.data[0].value

        } catch (e) {

            console.log(e)

        }

    }



    // 获取平均响应时长图表

    public handleAverageTimeChart = async () => {

        try {

            let arrY: number[] = []

            let arrX: string[] = []

            const resp = (await getAverageTimeChart({})).data

            resp.data.slice(0, 12).forEach((item) => {

                arrX.push(item.time)

                arrY.push(Math.round((parseFloat(item.value) + Number.EPSILON) * 100) / 100)

            })

            this.averageDataY = arrY

            this.averageDataX = arrX

        } catch (e) {

            console.log(e)

        }

    }



    // 获取平均维修天数

    public handleAverageDay = async () => {

        try {

            const resp = (await getAverageDay({})).data

            this.averageDay = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取平均维修天数图表

    public handleAverageDayChart = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getAverageDayChart({})).data

            resp.data.slice(0, 12).forEach((item) => {

                arrX.push(item.time)

                arrY.push(Math.round((parseFloat(item.avg) + Number.EPSILON) * 100) / 100)

            })

            this.averageDayY = arrY

            this.averageDayX = arrX

        } catch (e) {

            console.log(e)

        }

    }



    // 获取紧急备件响应时间

    public handleResponseTime = async (type: string) => {

        try {

            const resp = (await getResponseTime({

                finished: type

            })).data

            if (type === 'critical') {

                this.responseTime = resp.data.rate

            } else {

                this.responseTimeU = resp.data.rate

            }

        } catch (e) {

            console.log(e)

        }

    }



    // 获取紧急备件响应时间图表

    public handleResponseTimeChart = async (type: string) => {

        try {

            let arrX: string[] = []

            let arrF: number[] = []
            let temp: any[] = [];
            const resp = (await getResponseTimeChart({

                finished: type

            })).data

            this.identify = resp.status == 1 ? true : false;
            console.log(resp, '看看返回', this.identify);
            for (let item of resp.data.list) {
                let obj = {
                    time: '',
                    value: 0,
                }
                obj.time = item.key
                obj.value = item.doubleValue;
                temp.push(obj)
            }
            temp.sort((a, b) => {
                return a.time > b.time ? 1 : -1
            })
            console.log(temp, '排序后')
            for (let item of temp) {

                arrX.push(item.time)

                arrF.push(item.value);

            }

            if (type === 'urgent') {

                this.responseTimeUX = arrX

                this.responseTimeUFY = arrF

                this.newResAverage = resp.data.number

            } else {

                this.responseTimeX = arrX

                this.responseTimeFY = arrF
                this.newTimeAverage = resp.data.number
            }

        } catch (e) {

            console.log(e)

        }

    }



    // 获取最近两小时内新的openWo信息

    public handleOpenWo = async () => {

        try {

            const resp = (await getOpenWo({})).data

            this.openWo = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取未完成打开的Wo信息

    public getNotOpenWo = async () => {

        try {

            const resp = (await getNotOpenWo({})).data

            this.noOpenWo = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取未完成打开的Wo信息图表

    public getNotOpenWoChart = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getNotOpenWoChart({})).data

            resp.data.slice(0, 5).forEach((item) => {

                arrX.push(item.PurposeofVisit)

                arrY.push(item.num)

            })

            this.noOpenWoX = arrX

            this.noOpenWoY = arrY

        } catch (e) {

            console.log(e)

        }

    }



    // 获取热门工单列表

    public handleGetHotOrder = async () => {

        try {

            const resp = (await getHotOrder({})).data

            this.hotOrderList = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取待批准备件列表

    public handleGetPrepareOrder = async () => {

        try {

            const resp = (await getPrepareOrder({})).data

            this.prepareList = resp.data

        } catch (e) {

            console.log(e)

        }

    }
    @observable
    public LogisticsArr:any[] = [];
    // 获取备件订单信息 新的
    public handleGetLogistics = async () => {
        try {

            const resp = (await getLogistics({
                SerialLotNumber:''
            })).data
            this.LogisticsArr = resp.data;
            console.log(resp,'备件物流信息',this.LogisticsArr)

        } catch (e) {

            console.log(e)

        }
    }
    // 获取备件订单信息 具体
    public handleGetLogisticsNew = async () => {
        try {

            const resp = (await getLogistics({
                SerialLotNumber:this.SerialLotNumber
            })).data
            this.LogisticsArr = resp.data;
            console.log(resp,'备件物流信息具体',this.LogisticsArr)

        } catch (e) {

            console.log(e)

        }
    }
    // 获取紧急备件订单信息

    public handleGetEmergencyr = async () => {

        try {

            const resp = (await getFlyLine({})).data
            console.log(resp,'调用了吗')
            this.emergencyrList = resp.data

            resp.data.forEach(item => {
                this.flyLine.push([{name:item.origCity},{name:item.destCity,value: 100}])
                // item.data.forEach(item1 => {

                //     this.flyLine.push([{ name: item1.origcity }, {

                //         name: item1.operateplace.slice(item1.origcity.length, item1.operateplace.length),

                //         value: 100

                //     }])

                // })

            })
            console.log(this.flyLine,'飞线图数据')
            console.log(resp,'接口返回数据')
        } catch (e) {

            console.log(e)

        }

    }



    // 获取东北区客户服务区域

    public getNortheastArea = async (area: string) => {

        try {

            const resp = (await getNortheastArea({

                PreferredServiceTeam: area

            })).data

            switch (area) {

                case 'APAC CAMT NorthEast':

                    this.northEastArea = resp.data

                    break;

                case 'APAC CAMT North':

                    this.northArea = resp.data

                    break;

                case 'APAC CAMT West':

                    this.westArea = resp.data

                    break;

                case 'APAC CAMT East':

                    this.eastArea = resp.data

                    break;

                case 'APAC CAMT South':

                    this.southArea = resp.data

                    break;

            }

        } catch (e) {

            console.log(e)

        }

    }



    // 获取地图的预警灯SMX数据

    public handleGetWaring = async () => {

        try {

            let redArr: any[] = []

            let yellowArr: any[] = []

            let redNum: any[] = []

            let yellowNum: any[] = []

            const resp = (await getWaringLight({})).data

            this.waringLight = resp.data

            resp.data.data_red.forEach((item) => {

                redArr.push([item.Longitude, item.Latitude])

                redNum.push({

                    key: [item.Longitude, item.Latitude],

                    value: item.SerialLotNumber

                })

            })

            resp.data.data_yellow.forEach((item) => {

                yellowArr.push([item.Longitude, item.Latitude])

                yellowNum.push({

                    key: [item.Longitude, item.Latitude],

                    value: item.SerialLotNumber

                })

            })

            this.yellowArr = yellowArr

            this.redArr = redArr

            this.macNumArr = [...redNum, ...yellowNum]

        } catch (e) {

            console.log(e)

        }

    }



    // 获取地图的预警灯LOG数据

    public handleGetWaringLOG = async () => {

        try {

            let waringArrLog: any[] = []

            let redArrLog: any[] = []

            let yellowArrLog: any[] = []

            let numLog: any[] = []

            const resp = (await getWaringLightLOG({})).data

            for (let item in resp.data) {

                waringArrLog.push(resp.data[item])

            }

            this.waringLightLog = waringArrLog

            this.waringLightLog.forEach((item) => {

                numLog.push({

                    key: [item.Longitude, item.Latitude],

                    value: item.MachineId

                })

                if (item.warning === 'Critical') {

                    redArrLog.push([item.Longitude, item.Latitude])

                } else {

                    yellowArrLog.push([item.Longitude, item.Latitude])

                }

            })

            this.redArrLog = redArrLog

            this.yellowArrLog = yellowArrLog

            this.macNumArrLog = numLog

        } catch (e) {

            console.log(e)

        }

    }



    // 获取地图的预警灯数据(全部)

    public handleGetWaringAll = async () => {

        try {

            let arr: any[] = []

            let num: any[] = []

            const resp = (await getAllMac({})).data

            resp.data.forEach((item) => {

                num.push({

                    key: [item.Longitude, item.Latitude],

                    value: item.MachineId

                })

                arr.push([item.Longitude, item.Latitude])

            })

            this.lightAll = arr

            this.numAll = num

        } catch (e) {

            console.log(e)

        }

    }



    // 获取右侧滚屏的标题

    public handleGetSlide = async () => {

        try {

            const resp = (await getSlideTitle({})).data

            let str = resp.data[0].WarningReason

            let st = ''

            JSON.parse(str).forEach((item) => {

                st = st.concat(item) + '$'

            })

            this.slideTitle = resp.data[0].warning + '&' + resp.data[0].MachineId + '$' + st

        } catch (e) {

            console.log(e)

        }

    }



    // 记录预测警报前十名

    public handleGetPredictWaring = async () => {

        try {

            const resp = (await getPredictWaring({})).data

            this.predictWarning = resp.data.slice(0, 10)

        } catch (e) {

            console.log(e)

        }

    }
    // 错误日志Top10
    public getTop10Data = async () => {

        try {

            const resp = (await getTop10({})).data
            this.top10Data = resp.data
            console.log(this.top10Data, '错误日志Top10')

        } catch (e) {

            console.log(e)

        }

    }
    // 记录错误率前十名

    public handleGetError = async () => {

        try {

            const resp = (await getError({

                sort: 'desc'

            })).data

            this.error = resp.data.slice(0, 10)
            console.log(this.error, '错误率前10');

        } catch (e) {

            console.log(e)

        }

    }



    // 获取上次日志输入的年龄

    public handleBeforeAge = async () => {

        try {

            const resp = (await getBeforeAge({})).data

            this.beforeAge = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取上次日志输入的年龄图表

    public handleBeforeAgeChart = async () => {

        try {

            const resp = (await getBeforeAgeChart({})).data

            let arrX: string[] = []

            let arrY: number[] = []

            resp.data.slice(0, 8).forEach((item) => {

                arrX.push(item.MachineId)

                arrY.push(parseFloat(item.age))

            })

            this.beforeChartY = arrY

            this.beforeChartX = arrX

        } catch (e) {

            console.log(e)

        }

    }



    // 获取每小时光束

    public handleLightHour = async () => {

        try {

            const resp = (await getLightHour({})).data

            console.log(resp.data, 88888)

        } catch (e) {

            console.log(e)

        }

    }

    // 获取异常中断
    public handleExceptionTX = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getExceptionInterrupt({})).data

            resp.data.slice(0, 5).forEach((item) => {

                arrX.push(item.MachineId)

                arrY.push(item.num)

            })

            this.ExceptionX = arrX

            this.ExceptionY = arrY

        } catch (e) {

            console.log(e)

        }

    }

    // 获取设备负荷
    public handleEquipmentTX = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getEquipmentLoad({})).data

            resp.data.slice(0, 5).forEach((item) => {

                arrX.push(item.MachineId)

                arrY.push(item.num)

            })

            this.EquipmentX = arrX

            this.EquipmentY = arrY

        } catch (e) {

            console.log(e)

        }

    }

    // 获取patient TX前五名

    public handlePatientTX = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getPatientTX({})).data

            resp.data.slice(0, 5).forEach((item) => {

                arrX.push(item.MachineId)

                arrY.push(item.num)

            })

            this.patientTXX = arrX

            this.patientTXY = arrY

        } catch (e) {

            console.log(e)

        }

    }



    // 获取patient MVCT前五名

    public handlePatientMVCT = async () => {

        try {

            let arrMTXX: string[] = []

            let arrMTXY: number[] = []

            let arrMVCTX: string[] = []

            let arrMVCTY: number[] = []

            const resp = (await getPatientMVCT({})).data

            resp.data[0].slice(0, 5).forEach((item) => {

                arrMTXX.push(item.MachineId)

                arrMTXY.push(item.txnum)

            })

            resp.data[1].slice(0, 5).forEach((item) => {

                arrMVCTX.push(item.MachineId)

                arrMVCTY.push(item.MVCTnum)

            })

            this.patientMTXX = arrMTXX

            this.patientMTXY = arrMTXY

            this.patientMVCTX = arrMVCTX

            this.patientMVCTY = arrMVCTY

        } catch (e) {

            console.log(e)

        }

    }



    // 获取当年工时消耗情况(单设备列表)

    public handleGetConsume = async () => {

        try {

            let arrX: string[] = []

            let arrY: number[] = []

            const resp = (await getThatYearConsume({

                SerialLotNumber: this.SerialLotNumber ? this.SerialLotNumber : ''

            })).data

            resp.data.slice(0, 4).forEach((item) => {

                arrX.push(item.PurposeofVisit)

                arrY.push(Math.round((item.QtyInstalled + Number.EPSILON) * 100) / 100)

            })

            this.dayConsumeX = arrX

            this.dayConsumeY = arrY

        } catch (e) {

            console.log(e)

        }

    }



    // 获取当年备件消耗情况(单设备列表)

    public handleGetEquipConsume = async () => {

        try {

            const resp = (await getEquipConsume({

                SerialLotNumber: this.SerialLotNumber ? this.SerialLotNumber : ''

            })).data

            this.equipConsume = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取工程师状态表

    public handleGeState = async () => {

        try {

            const resp = (await getState({})).data

            this.engineerStatus = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取停机时间

    public handleGetDownTime = async () => {

        try {

            let arrX: string[] = []

            let arrYB: number[] = []

            let arrYL: number[] = []

            const resp = (await getDownTime({

                SerialLotNumber: this.SerialLotNumber ? this.SerialLotNumber : ''

            })).data

            resp.data.forEach((item) => {

                arrX.push(item.time)

                arrYB.push(item.sum_CAMTDownHours)

                arrYL.push(item.all_sum_CAMTDownHours)

            })

            this.downTimeX = arrX

            this.downTimeYB = arrYB

            this.downTimeYL = arrYL

        } catch (e) {

            console.log(e)

        }

    }



    // 获取停机时间摘要

    public handleGetDownTimeC = async () => {

        try {

            const resp = (await getDownTimeC({

                SerialLotNumber: this.SerialLotNumber

            })).data

            this.uptime_rate = parseFloat(resp.data.uptime_rate)

        } catch (e) {

            console.log(e)

        }

    }



    // 获取未结工作单

    public handleGetUnfinished = async () => {

        try {

            const resp = (await getUnfinished({
                SerialLotNumber: this.SerialLotNumber
            })).data

            this.unFinished = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 日志预测警报

    public handleGetLog = async () => {

        try {

            const resp = (await getLogWarning({
                //MachineId: 110553
                MachineId: this.SerialLotNumber

            })).data

            this.getLogInfo = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 错误率前十名

    public handleGetErrorTen = async () => {

        try {

            const resp = (await getErrorTen({

                MachineId: this.SerialLotNumber

            })).data

            this.errorTen = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取上光时间

    public handleGlazingTime = async () => {

        try {

            let arrX: string[] = []

            let arrY1: number[] = []

            let arrY2: number[] = []

            const resp = (await getGlazingTime({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrX.push(item.time)

                arrY1.push(item.ImageOn)

                arrY2.push(item.TreatmentOn)

            })

            this.beamHourX = arrX

            this.beamHourY1 = arrY1

            this.beamHourY2 = arrY2

        } catch (e) {

            console.log(e)

        }

    }



    // 获取预防性维修进度

    public handlePreProgress = async () => {

        try {

            const arrX: string[] = []

            const arrY1: any[] = []

            const arrY2: any[] = []

            const resp = (await getPreProgressList({

                SerialLotNumber: this.SerialLotNumber

            })).data

            resp.data.x_list.forEach((item) => {

                arrX.push(String( new Date(item * 1000).getFullYear() + '年' + (new Date(item * 1000).getMonth() + 1)) + '月' + new Date(item * 1000).getDate() + '日')

            })

            this.processX = arrX
            console.log(this.processX,'过滤后的日期')
            resp.data.y_list['AllWorkOrders_data'].forEach((item, index) => {

                if ('Schedule A PM' === item) {

                    arrY1.push([arrX[index], '1个月'])

                } else if ('Schedule B PM' === item) {

                    arrY1.push([arrX[index], '3个月'])

                } else if ('Schedule C PM' === item) {

                    arrY1.push([arrX[index], '6个月'])

                } else if ('Schedule D PM' === item) {

                    arrY1.push([arrX[index], '1年'])

                } else if (item == '0') {

                    arrY1.push([arrX[index], 0])

                }

            })

            this.processY1 = arrY1// 未完成
            console.log(this.processY1,'过滤后的日期')
            resp.data.y_list['AllCompletedWorkOrders_data'].forEach((item, index) => {

                if ('Schedule A PM' === item) {

                    arrY2.push([arrX[index], '1个月'])

                } else if ('Schedule B PM' === item) {

                    arrY2.push([arrX[index], '3个月'])

                } else if ('Schedule C PM' === item) {

                    arrY2.push([arrX[index], '6个月'])

                } else if ('Schedule D PM' === item) {

                    arrY2.push([arrX[index], '1年'])

                } else if (item == '0') {

                    arrY2.push([arrX[index], 0])

                }

            })

            this.processY2 = arrY2// 已完成
            console.log(this.processY2,'过滤后的日期')
        } catch (e) {

            console.log(e)

        }

    }



    // 获取每日错误率

    public handleDailyError = async () => {

        try {

            let arr: number[][] = []

            const resp = (await getDailyError({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.slice(0, 20).forEach((item) => {

                arr.push([item.time, item.rate])

            })

            this.dailyError = arr

        } catch (e) {

            console.log(e)

        }

    }



    // 发送中断

    public handleInterrupt = async () => {

        try {

            let arrY1: number[] = []

            let arrY2: number[] = []

            let arrY3: number[] = []

            let arrY2All: number = 0

            let arrY3All: number = 0

            let arrY4All: number = 0

            let arrY5All: number = 0

            let arrY4: number[] = []

            let arrY5: number[] = []

            let arrX: string[] = []

            const resp = (await getInterrupt({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.mvct.forEach((item) => {

                arrY2.push(item.num)

                arrX.push(item.time)

                arrY2All += item.num

            })

            resp.data.tx.forEach((item) => {

                arrY3.push(item.num)

                arrY3All += item.num

            })

            resp.data.QA.forEach((item) => {

                arrY4.push(item.num)

                arrY4All += item.num

            })

            resp.data.PatientQA.forEach((item) => {

                arrY5.push(item.num)

                arrY5All += item.num

            })

            // 累加获得arrY1

            arrY1 = (arrY2.map((item, index) => item + arrY3[index]))

            this.interruptX = arrX

            this.interruptY1 = arrY1

            this.interruptY2 = arrY2

            this.interruptY3 = arrY3

            this.interruptY2All = resp.data.mvctNumber

            this.interruptY3All = resp.data.txNumber

            this.interruptY4All = arrY4All

            this.interruptY5All = arrY5All

            this.interruptY4 = arrY4

            this.interruptY5 = arrY5

        } catch (e) {

            console.log(e)

        }

    }



    // 获取MLC气压

    public handleMLCPressure = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getMLCPressure({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.BackJawPotValue)])

                arrY2.push([item.time, parseFloat(item.FrontJawPotValue)])

                arrY3.push([item.time, parseFloat(item.AirPress)])

            })

            this.JawPotY1 = arrY1

            this.JawPotY2 = arrY2

            this.JawPotY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // 获取水流
    @observable
    public waterFlowData: any = {
        dataY1: [],
        dataY2: [],
        dataY3: [],
        dataY4: [],
        dataY5: [],
    }
    @observable
    public waterFixData: any = {
        dataY1: [],
        dataY2: [],
        dataY3: [],
        dataY4: [],
        dataY5: [],
        dataY6: [],
        dataY7: [],
        dataY8: [],
    }
    @observable
    public WaterType: Boolean = false;
    public handleWaterFlow = async () => {

        try {

            let data1: number[][] = []

            let data2: number[][] = []

            let data3: number[][] = []

            let data4: number[][] = []

            let data5: number[][] = []
            let data6: number[][] = []

            let data7: number[][] = []

            let data8: number[][] = []
            const resp = (await getWaterFlow({

                MachineId: this.SerialLotNumber

            })).data
            let data = resp.data.list;
            let status = resp.data.radixact;
            this.WaterType = status ? status : false;
            console.log(this.WaterType, status)
            if (status) {
                data.forEach((item) => {
                    data1.push([item.time, parseFloat(item.Hvps)]);
                    data2.push([item.time, parseFloat(item.LinacBody)]);

                    data3.push([item.time, parseFloat(item.LinacRfWindow)]);

                    data4.push([item.time, parseFloat(item.LinacTarget)]);

                    data5.push([item.time, parseFloat(item.Magnetron)]);
                    data6.push([item.time, parseFloat(item.MagnetronMagnet)]);
                    data7.push([item.time, parseFloat(item.Modulator)]);
                    data8.push([item.time, parseFloat(item.PortCirculator)]);
                });

                this.waterFixData.dataY1 = data1;
                this.waterFixData.dataY2 = data2;
                this.waterFixData.dataY3 = data3;
                this.waterFixData.dataY4 = data4;
                this.waterFixData.dataY5 = data5;
                this.waterFixData.dataY6 = data6;
                this.waterFixData.dataY7 = data7;
                this.waterFixData.dataY8 = data8;
            } else {
                data.forEach((item) => {
                    data1.push([item.time, parseFloat(item.CircDmpFlow)]);

                    data2.push([item.time, parseFloat(item.ssmflow)]);

                    data3.push([item.time, parseFloat(item.MagMagFlow)]);

                    data4.push([item.time, parseFloat(item.RFWinFlow)]);

                    data5.push([item.time, parseFloat(item.TargFlow)]);
                    data6.push([item.time, parseFloat(item.GuideFlow)]);
                });
                this.waterFlowData.dataY1 = data1;
                this.waterFlowData.dataY2 = data2;
                this.waterFlowData.dataY3 = data3;
                this.waterFlowData.dataY4 = data4;
                this.waterFlowData.dataY5 = data5;
                this.waterFlowData.dataY6 = data6;
            }
            console.log(resp, '现在返回的数据格式')


        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/MVCT_Dose_Rate

    public handleMVCTDoseRate = async (type: string) => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getMVCTDoseRate({

                MachineId: this.SerialLotNumber,

                ProcedureType: type

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSDoseVarHi)])

                arrY2.push([item.time, parseFloat(item.DCSDoseVarLow)])

                arrY3.push([item.time, parseFloat(item.DCSNorminal1Dose)])

            })

            if (type === 'MVCT') {

                // 取三个值

                this.MVCTDoseRateY1 = arrY1

                this.MVCTDoseRateY2 = arrY2

                this.MVCTDoseRateY3 = arrY3

            } else {

                this.sendInterruptY1 = arrY1

                this.sendInterruptY2 = arrY2

                this.sendInterruptY3 = arrY3

            }

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/Temperature(温度)

    public handleTemperature = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getTemperature({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.AmbAirTemp)])

                arrY2.push([item.time, parseFloat(item.WaterReturnTemp)])

                arrY3.push([item.time, parseFloat(item.WaterSupplyTemp)])

            })

            this.TemperatureY1 = arrY1

            this.TemperatureY2 = arrY2

            this.TemperatureY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/最终剂量一率

    public handleFinalDose = async () => {

        let arrY1: number[][] = []

        let arrY2: number[][] = []

        try {

            const resp = (await getFinalDose({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                if (item.ProcedureType === 'MVCT') {

                    arrY1.push([item.time, parseFloat(item.FinalDose1Rate)])

                } else {

                    arrY2.push([item.time, parseFloat(item.FinalDose1Rate)])

                }

            })

            this.FinalDose1RateY1 = arrY1

            this.FinalDose1RateY2 = arrY2

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/TX_Gun_I

    public handleTxGunI = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getTxGunI({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSGunIVarHi)])

                arrY2.push([item.time, parseFloat(item.DCSGunIVarLow)])

                arrY3.push([item.time, parseFloat(item.DCSNorminalGunI)])

            })

            this.TxGunIY1 = arrY1

            this.TxGunIY2 = arrY2

            this.TxGunIY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/MVCT_Gun_I

    public handleMVCTGunI = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getMVCTGunI({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSGunIVarHi)])

                arrY2.push([item.time, parseFloat(item.DCSGunIVarLow)])

                arrY3.push([item.time, parseFloat(item.DCSNorminalGunI)])

            })

            this.MvctGunIY1 = arrY1

            this.MvctGunIY2 = arrY2

            this.MvctGunIY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/Tx_PAC

    public handleTxPAC = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            let arrY4: number[][] = []

            let arrY5: number[][] = []

            const resp = (await getTxPAC({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.PACAvg)])

                arrY2.push([item.time, parseFloat(item.PACControlRangeLimitsHi)])

                arrY3.push([item.time, parseFloat(item.PACControlRangeLimitsLow)])

                arrY4.push([item.time, parseFloat(item.PACMax)])

                arrY5.push([item.time, parseFloat(item.PACMin)])

            })

            this.TxPacY1 = arrY1

            this.TxPacY2 = arrY2

            this.TxPacY3 = arrY3

            this.TxPacY4 = arrY4

            this.TxPacY5 = arrY5

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/MVCT_PAC

    public handleMVCTPAC = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            let arrY4: number[][] = []

            let arrY5: number[][] = []

            const resp = (await getMVCTPAC({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.PACAvg)])

                arrY2.push([item.time, parseFloat(item.PACControlRangeLimitsHi)])

                arrY3.push([item.time, parseFloat(item.PACControlRangeLimitsLow)])

                arrY4.push([item.time, parseFloat(item.PACMax)])

                arrY5.push([item.time, parseFloat(item.PACMin)])

            })

            this.MvctPacY1 = arrY1

            this.MvctPacY2 = arrY2

            this.MvctPacY3 = arrY3

            this.MvctPacY4 = arrY4

            this.MvctPacY5 = arrY5

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/Tx_Inj_I

    public handleTxInjI = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            let arrY4: number[][] = []

            let arrY5: number[][] = []

            const resp = (await getTxInjI({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSInjIProcAvg)])

                arrY2.push([item.time, parseFloat(item.DCSInjIProcHi)])

                arrY3.push([item.time, parseFloat(item.DCSInjIProcLow)])

                arrY4.push([item.time, parseFloat(item.InjIControlRangeLimitsHi)])

                arrY5.push([item.time, parseFloat(item.InjIControlRangeLimitsLow)])

            })

            this.TxInjIPacY1 = arrY1

            this.TxInjIPacY2 = arrY2

            this.TxInjIPacY3 = arrY3

            this.TxInjIPacY4 = arrY4

            this.TxInjIPacY5 = arrY5

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/MVCT_Inj_I

    public handleMVCTInjI = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            let arrY4: number[][] = []

            let arrY5: number[][] = []

            const resp = (await getMVCTInjI({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSInjIProcAvg)])

                arrY2.push([item.time, parseFloat(item.DCSInjIProcHi)])

                arrY3.push([item.time, parseFloat(item.DCSInjIProcLow)])

                arrY4.push([item.time, parseFloat(item.InjIControlRangeLimitsHi)])

                arrY5.push([item.time, parseFloat(item.InjIControlRangeLimitsLow)])

            })

            this.MvctInjIPacY1 = arrY1

            this.MvctInjIPacY2 = arrY2

            this.MvctInjIPacY3 = arrY3

            this.MvctInjIPacY4 = arrY4

            this.MvctInjIPacY5 = arrY5

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/Tx_AFC

    public handleTxAFC = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getTxAFC({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSAFCPosAvg)])

                arrY2.push([item.time, parseFloat(item.DCSAFCPosMax)])

                arrY3.push([item.time, parseFloat(item.DCSAFCPosMin)])

            })

            this.TxAfcY1 = arrY1

            this.TxAfcY2 = arrY2

            this.TxAfcY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // 获取四周的数据/MVCT_AFC

    public handleMVCTAFC = async () => {

        try {

            let arrY1: number[][] = []

            let arrY2: number[][] = []

            let arrY3: number[][] = []

            const resp = (await getMVCTAFC({

                MachineId: this.SerialLotNumber

            })).data

            resp.data.forEach((item) => {

                arrY1.push([item.time, parseFloat(item.DCSAFCPosAvg)])

                arrY2.push([item.time, parseFloat(item.DCSAFCPosMax)])

                arrY3.push([item.time, parseFloat(item.DCSAFCPosMin)])

            })

            this.MvctAfcY1 = arrY1

            this.MvctAfcY2 = arrY2

            this.MvctAfcY3 = arrY3

        } catch (e) {

            console.log(e)

        }

    }



    // // 获取设备图标

    public handleGetLogo = async () => {

        try {

            const resp = (await getMacLogo({

                SerialLotNumber: this.SerialLotNumber

            })).data

            this.deviceInfo = resp.data

        } catch (e) {

            console.log(e)

        }

    }



    // 获取设备图标

    public handleLogo = async () => {

        try {

            const resp = (await getMacInfo({

                SerialLotNumber: this.SerialLotNumber

            })).data

            this.location = resp.data.Location

        } catch (e) {

            console.log(e)

        }

    }
    // 获取新日志top5
    public getTopLog = async () => {
        try {
            const resp = (await getNewLog({
                condition: {
                    serialOrLotNumber: this.SerialLotNumber,
                    searchType: 'chart',
                    locationName: '',
                    beginTime: '',
                    endTime: '',
                },
                pageIndex: '-1',
                pageSize: 1,

            })).data
            let cache = resp.data.rows[0]
            this.logTop = Object.prototype.hasOwnProperty.call(cache, 'logTop5') ? cache.logTop5 : [];
            console.log(this.logTop, '日志top5返回数据')
        } catch (e) {
            console.log(e)
        }
    }


}



export default new FirstStore;

